import React, { Suspense } from 'react';
import ReactDOM from 'react-dom';
import { ActivityIndicator } from 'antd-mobile';
import './index.css';
import * as serviceWorker from './serviceWorker';

const App = React.lazy(() => import('./App'));

renderWithHotReload(App);

/* 热更新 */
if (module.hot) {
  module.hot.accept('./App', () => {
    renderWithHotReload(App);
  });
}

function renderWithHotReload(App) {
  return ReactDOM.render(
    (
      <Suspense fallback={<ActivityIndicator toast text="正在加载..." />}>
        <App />
      </Suspense>
    ),
  document.getElementById('root'));
}


// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
